Issue with finding a keyword including more than one colon?

Hello,

It seems I have an issue with the colon by using the keyword function. Does anybody know why the second colon results all the time to a no match of the function?
Beforehand thanks a lot for your support. Please find in advanced the coding example to showing the issue.
Buffer BBuffer = create;
const string c_szTestString = "http://server0815.auto.wan.com:1001/tbd/tbdtbdtbd/tbd";
const string c_szKeywordNotFound = "http://server0815.auto.wan.com:1001/";
const string c_szKeywordFound = "http://server0815.auto.wan.com";
int iOffset = 0;

BBuffer = c_szTestString;

iOffset = keyword(BBuffer, c_szKeywordFound, 0);

if(iOffset == -1)
{
print("Keyword not found!\n");
}
else
{
print("Keyword found!\n");
}

iOffset = keyword(BBuffer, c_szKeywordNotFound, 0);

if(iOffset == -1)
{
print("Keyword not found!\n");
}
else
{
print("Keyword found!\n");
}
delete(BBuffer);
WildThunderGuy - Thu Aug 12 05:44:49 EDT 2010

Re: Issue with finding a keyword including more than one colon?
Rolan - Thu Aug 12 11:54:01 EDT 2010

Seems to work if the trailing '/' is removed from c_szKeywordNotFound. Might be more of an issue with the exception for 'keyword' from the DXL reference ->"provided that the string is neither preceded nor followed by a non-alphanumeric character".
Maybe using 'contains' rather than 'keyword' would better suit your need.

Re: Issue with finding a keyword including more than one colon?
WildThunderGuy - Fri Aug 13 08:31:43 EDT 2010

Thanks a lot for your support, actually I also believe the issue comes up because of non-alphanumeric character.

Re: Issue with finding a keyword including more than one colon?
doors36677 - Fri Aug 13 12:22:05 EDT 2010

Try:

Buffer BBuffer = create;
const string c_szTestString = "http://server0815.auto.wan.com:1001/tbd/tbdtbdtbd/tbd";
const string c_szKeywordNotFound = "http://server0815.auto.wan.com:1001/";
const string c_szKeywordFound = "http://server0815.auto.wan.com";
int iOffset = 0;
 
BBuffer = c_szTestString;
iOffset = contains(BBuffer, c_szKeywordFound, 0);
 
if(iOffset == -1)
{ print("Keyword not found!\n");
}else
{ print("Keyword found!\n");
}
 
iOffset = contains(BBuffer, c_szKeywordNotFound, 0);
 
if(iOffset == -1)
{ print("Keyword not found!\n");
}else
{ print("Keyword found!\n");
}